package com.zzl.finance.data.constant;

import com.zzl.finance.data.dto.KeyValueDto;

import java.util.ArrayList;
import java.util.List;

/**
 * 用章类型 1 公章
 * @author : gull
 * @date : 2022/2/16 15:02
 */
public enum SealTypeEnum {
    /**
     * 自建
     */
    SEAL_TYPE_OFFICIAL(1, "公章"),
    SEAL_TYPE_CONTRACT(2, "合同章"),

    ;


    private final Integer code;
    private final String value;


    SealTypeEnum(Integer code, String value) {
        this.code = code;
        this.value = value;
    }

    public static String getValue(Integer code) {
        for (SealTypeEnum statusEnum : SealTypeEnum.values()) {
            if (statusEnum.code.equals(code)) {
                return statusEnum.value;
            }
        }
        return "";
    }

    /**
     * 下拉框查询用章类型列表
     */
    public static List<KeyValueDto> getSealTypeList() {
        List<KeyValueDto> list = new ArrayList<>();
        for (SealTypeEnum sealTypeEnum : SealTypeEnum.values()) {
            KeyValueDto keyValueDto = new KeyValueDto();
            keyValueDto.setCode(sealTypeEnum.code);
            keyValueDto.setValue(sealTypeEnum.value);
            list.add(keyValueDto);
        }
        return list;
    }


    public Integer getCode() {
        return code;
    }

    public String getValue() {
        return value;
    }
}
